package com.airforce.mappers;

import com.airforce.model.option;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface optionMapper {
    @Delete({
        "delete from option",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into option (id, optionID, ",
        "A, B, C, ",
        "D, createtime, ",
        "updatetime)",
        "values (#{id,jdbcType=INTEGER}, #{optionid,jdbcType=VARCHAR}, ",
        "#{a,jdbcType=VARCHAR}, #{b,jdbcType=VARCHAR}, #{c,jdbcType=VARCHAR}, ",
        "#{d,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP}, ",
        "#{updatetime,jdbcType=TIMESTAMP})"
    })
    int insert(option record);

    @InsertProvider(type=optionSqlProvider.class, method="insertSelective")
    int insertSelective(option record);

    @Select({
        "select",
        "id, optionID, A, B, C, D, createtime, updatetime",
        "from option",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="optionID", property="optionid", jdbcType=JdbcType.VARCHAR),
        @Result(column="A", property="a", jdbcType=JdbcType.VARCHAR),
        @Result(column="B", property="b", jdbcType=JdbcType.VARCHAR),
        @Result(column="C", property="c", jdbcType=JdbcType.VARCHAR),
        @Result(column="D", property="d", jdbcType=JdbcType.VARCHAR),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="updatetime", property="updatetime", jdbcType=JdbcType.TIMESTAMP)
    })
    option selectByPrimaryKey(Integer id);

    @UpdateProvider(type=optionSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(option record);

    @Update({
        "update option",
        "set optionID = #{optionid,jdbcType=VARCHAR},",
          "A = #{a,jdbcType=VARCHAR},",
          "B = #{b,jdbcType=VARCHAR},",
          "C = #{c,jdbcType=VARCHAR},",
          "D = #{d,jdbcType=VARCHAR},",
          "createtime = #{createtime,jdbcType=TIMESTAMP},",
          "updatetime = #{updatetime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(option record);



}